package com.datechange.demo.service.impl;

import com.datechange.demo.dao.CmsChannelComparisonDao;
import com.datechange.demo.entity.CmsChannelComparison;
import com.datechange.demo.service.CmsChannelComparisonService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (CmsChannelComparison )表服务实现类
 *
 * @author makejava
 * @since 2020-12-14 10:20:09
 */
@Service
public class CmsChannelComparisonServiceImpl implements CmsChannelComparisonService {
    @Resource
    private CmsChannelComparisonDao cmsChannelComparisonDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public CmsChannelComparison queryById(String id) {
        return this.cmsChannelComparisonDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<CmsChannelComparison> queryAllByLimit(int offset, int limit) {
        return this.cmsChannelComparisonDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param cmsChannelComparison 实例对象
     * @return 实例对象
     */
    @Override
    public CmsChannelComparison insert(CmsChannelComparison cmsChannelComparison) {
        this.cmsChannelComparisonDao.insert(cmsChannelComparison);
        return cmsChannelComparison;
    }

    /**
     * 修改数据
     *
     * @param cmsChannelComparison 实例对象
     * @return 实例对象
     */
    @Override
    public CmsChannelComparison update(CmsChannelComparison cmsChannelComparison) {
        this.cmsChannelComparisonDao.update(cmsChannelComparison);
        return this.queryById(cmsChannelComparison.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.cmsChannelComparisonDao.deleteById(id) > 0;
    }

    @Override
    public List<CmsChannelComparison> selectByCcId(String ccId,String topOrgCode) {
        return cmsChannelComparisonDao.selectByCcId(ccId,topOrgCode);
    }

    @Override
    public CmsChannelComparison selectByTitle(String cpcTitle) {

        return cmsChannelComparisonDao.selectByTitle(cpcTitle);
    }
}